<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:a="http://richfaces.org/a4j"
    template="layout/template.xhtml">

<ui:define name="body">

<a:loadScript src="js/sw-util.js" />
<a:loadScript src="js/jquery.maskedinput-1.3.js" />
<a:loadScript src="js/jquery.maskedinput-1.1.4.pack.js" />


    <h:form id="PesquisaLoteForm">

        <rich:panel>
            <f:facet name="header">Consulta Lote</f:facet>
            
            <s:decorate id="codigoLoteField" template="/layout/edit.xhtml">
                <ui:define name="label">Codigo Lote</ui:define>
                <h:inputText id="codigoLoteFieldId" value="#{ConsultaLote.codigoLote}" >
                </h:inputText>
            </s:decorate>

            <s:decorate id="statusLoteVendaField" template="/layout/edit.xhtml" >
                <ui:define name="label">Status Lote Venda</ui:define>
                <h:selectOneMenu id="statusLoteVendaId" value="#{ConsultaLote.statusLoteVenda}"  >
                    <s:selectItems value="#{statusLoteVendaList}"
                                   var="_statusLoteVenda"
                                   label="#{_statusLoteVenda}"
                                   noSelectionLabel="Selecione" >
                                   </s:selectItems>
                                <s:convertEnum/>  
                	<s:validate />
                </h:selectOneMenu>
            </s:decorate>

            <s:decorate id="statusLoteFinanceiroField" template="/layout/edit.xhtml" >
                <ui:define name="label">Status Lote Financeiro</ui:define>
                <h:selectOneMenu id="statusLoteFinanceiroId" value="#{ConsultaLote.statusLoteFinanceiro}"  >
                    <s:selectItems value="#{statusLoteFinanceiroList}"
                                   var="_statusLoteFinanceiro"
                                   label="#{_statusLoteFinanceiro}"
                                   noSelectionLabel="Selecione" >
                                   </s:selectItems>
                                <s:convertEnum/>  
                	<s:validate />
                </h:selectOneMenu>
            </s:decorate>						            
            
            <div style="clear:both"/>

	        <div class="actionButtons">
	            <a:commandButton id="btPesquisaLote" value="Consultar"
	                    action="#{ConsultaLote.consultaLote()}"  reRender="painelResultado"/>
	        </div>

        </rich:panel>
                

		    <rich:panel id="painelResultado">
		        <f:facet name="header">Listagem de Lote(s)</f:facet>
		
		        <div class="results">
		
		            <h:outputText value="Nenhum lote listado"
		                      rendered="#{empty ConsultaLote.lotes}" />
							
						<rich:dataTable id="loteList" value="#{ConsultaLote.lotes}"
							var="_loteSelecionado" rendered="#{not empty ConsultaLote.lotes}" >
							
							<h:column>
								<f:facet name="header">Codigo</f:facet>
		                    	#{_loteSelecionado.codigoLote}
							</h:column>
							
							<h:column>
								<f:facet name="header">Quadra</f:facet>
		                    	#{_loteSelecionado.quadra.codigo}
							</h:column>

							<h:column>
								<f:facet name="header">Status de Venda</f:facet>
		                    	#{_loteSelecionado.statusLoteVenda} 
							</h:column>

							<h:column>
								<f:facet name="header">Status Legal</f:facet>
		                    	#{_loteSelecionado.statusLoteLegal}
							</h:column>

							<h:column>
								<f:facet name="header">Status Financeiro</f:facet>
		                    	#{_loteSelecionado.statusLoteFinanceiro}
							</h:column>
							
		            </rich:dataTable>

		            		<h:outputText value="Total:  #{ConsultaLote.lotes.size()}" class="Total de Lote(s)" />
		            
		        </div>

		    </rich:panel>
		    


        <div class="actionButtons">
        </div>
    </h:form>

</ui:define>

</ui:composition>
